package org.example.project.controller;

import org.example.project.service.PlantRecognizeService;
import org.example.project.util.ResponseCode;
import org.example.project.util.ResponseData;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.io.IOException;

/**
 * @Author 岩
 * @Package org.example.project.controller
 * @Project MyApp
 * @Name PlantRecognizeController
 * @Date 2024-05-03 15:47
 * @Filename PlantRecognizeController
 */

@RestController
@RequestMapping("/recognize")
public class PlantRecognizeController {

    @Resource
    private PlantRecognizeService plantRecognize;

    @GetMapping
    public ResponseData recognize(@RequestParam("imagePath") String imagePath) throws IOException {
        return new ResponseData(ResponseCode.success, this.plantRecognize.recognize(imagePath));
    }
}
